Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

152
Visualizações
Issue with multiple entries on webpack using name "Main"

I am very new to using react, node js, and express. To get started I followed this tutorial from the official docs.

From my understanding, I have my webpack-config.js setup with multiple entries with the intent to generate multiple js files.

module.exports = {
    devtool: 'source-map',
    mode: "development",
    entry:
    {
        app: "./src/app/app.tsx",
        test: "./src/test/test.tsx"
    },
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: './[name]-app-bundle.js'
    },
    resolve: {
        extensions: ['.Webpack.js', '.web.js', '.ts', '.js', '.jsx', '.tsx']
    },
    module: {
        rules: [
            {
                test: /\.tsx$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: 'ts-loader'
                }
            }
        ]
    }
}

However, when I run npm run build or node_modules\.bin\webpack ./src/app/app.tsx ./src/test/test.tsx --config webpack-config.js I get the output:

> webpack-cli ./src/app/app.tsx ./src/test/test.tsx --config webpack-config.js

asset ./main-app-bundle.js 1.09 MiB [compared for emit] (name: main) 1 related asset
runtime modules 123 bytes 1 module
modules by path ./node_modules/ 1.08 MiB
  modules by path ./node_modules/react/ 85.7 KiB
    ./node_modules/react/index.js 190 bytes [built] [code generated]
    ./node_modules/react/cjs/react.development.js 85.5 KiB [built] [code generated]
  modules by path ./node_modules/react-dom/ 1000 KiB
    ./node_modules/react-dom/index.js 1.33 KiB [built] [code generated]
    ./node_modules/react-dom/cjs/react-dom.development.js 1000 KiB [built] [code generated]
  modules by path ./node_modules/scheduler/ 17.3 KiB
    ./node_modules/scheduler/index.js 198 bytes [built] [code generated]
    ./node_modules/scheduler/cjs/scheduler.development.js 17.1 KiB [built] [code generated]
modules by path ./src/ 2.9 KiB
  ./src/app/app.tsx 2.65 KiB [built] [code generated]
  ./src/test/test.tsx 250 bytes [built] [code generated]
webpack 5.74.0 compiled successfully in 1687 ms

From what I can see, both of my entries are being named "Main" as the file generated is named "main-app-bundle.js" and this is only generating the one js file (plus the map). After hours of researching and trying fixes, I am still unsure where I am going wrong here. Can anyone point me in the right direction?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda